#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define BUF (1024*1024*1)

int main()
{
    char buf[BUF] = {0};

    FILE *fp = fopen("log.txt", "w+");
    if (!fp)
    {
        perror("fopen");
        return -1;
    }

    if (0 != setvbuf(fp, buf, _IOFBF, BUF))
    {
        perror("setvbuf");
        return -1;
    }

    int i = 0;

    while (1)
    {
        fprintf(fp, "helloworld:%d\n", i++);
        usleep(10);
    }
    
    fclose(fp);

    return 0;
}


